<!-- 资产详情描述框 -->
<template>
  <div>
    <el-card class="mr20 ml20">
      <el-descriptions title="资产详情" :labelStyle="{ width: '10%' }" border>
        <template slot="extra">
          <el-button
            type="text"
            icon="el-icon-share"
            @click="
              () => {
                $router.push({
                  path: '/base-log/log/asset',
                  query: { id: form.id },
                });
              }
            "
          >
            日志
          </el-button>
        </template>
        <el-descriptions-item label="资产编号" :span="3">
          {{ form.code }}
        </el-descriptions-item>
        <el-descriptions-item label="资产类别" :contentStyle="{ width: '20%' }">
          {{ form.assetTypeName }}
        </el-descriptions-item>
        <el-descriptions-item label="资产名称" :span="2">
          {{ form.name }}
        </el-descriptions-item>
        <el-descriptions-item label="规格型号">
          {{ form.model }}
        </el-descriptions-item>
        <el-descriptions-item label="计量单位">
          {{ form.unit }}
        </el-descriptions-item>
        <el-descriptions-item label="资产原值" :span="2">
          {{ form.price }}
        </el-descriptions-item>
        <el-descriptions-item label="使用年限">
          {{ form.useLife }}
        </el-descriptions-item>
        <el-descriptions-item label="残值率">
          {{ form.valueRate }}
        </el-descriptions-item>
        <el-descriptions-item label="资产状态">
          <dict-tag :options="dict.type.asset_state" :value="form.assetState"/>
        </el-descriptions-item>
        <el-descriptions-item label="采购人">
          {{ form.createBy }}
        </el-descriptions-item>
        <el-descriptions-item label="采购时间" :span="2">
          {{ parseTime(form.createTime, "{y}年{m}月{d}日") }}
        </el-descriptions-item>
      </el-descriptions>
    </el-card>
  </div>
</template>

<script>
import { get } from "@/api/prod/asset/account";

export default {
  name: "Descriptions",
  dicts:['asset_state'],
  props: ["id"],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 基础信息
      form: {},
    };
  },

  created() {
    this.getDetail();
  },

  methods: {
    /** 表单重置 */
    reset() {},

    /** 查询资产详细 */
    getDetail() {
      this.loading = true;
      get(this.id).then((response) => {
        this.form = response.data;
        this.loading = false;
      });
    },
  },
};
</script>

<style>
</style>